package com.example.policymode5;

import com.example.policymode5.context.Context;
import com.example.policymode5.factory.IStrategy;

/**
 * @version 1.0.0
 * @className: Test
 * @description:
 * @author: zhangjunfa
 * @date: 2023/1/3 11:37
 */
public class Test {
    public static void main(String[] args) {
        // 创建具体策略
        IStrategy strategyA = new ConcreteStrategyA();
        IStrategy strategyB = new ConcreteStrategyB();
        // 创建上下文环境
        Context contextA = new Context(strategyA);
        Context contextB = new Context(strategyB);
        //客户端直接让上下文环境执行算法
        contextA.algorithm();
        contextB.algorithm();
    }

}
